<%-- 
    Document   : ChangeFilter.jsp
    Created on : 19 Apr 12, 19:33:13
    Author     : hartono
--%>
<%@page import="java.io.File"%>
<%@page import="main.LogicImageSegmentation"%>
<jsp:useBean id="lis" class="main.LogicImageSegmentation" scope="application"/>


<%

    try{
        // filter id
        // 0 - discretize
        // 1 - normalize
        // 2 - replace missing value
        // 3 - attributes selection
        String appPath = config.getServletContext().getRealPath("/");
    //    System.out.println("APP PATH : "+appPath);
        // data set path                 
        File ff = new File(appPath);
        //String dataSetPath = ff.getParentFile().getParentFile().toString() + "/";     // get /ImageSegmentation/ ..
        String dataSetPath = appPath;   // get /ImageSegmentation/ ..

        int filter_id = Integer.parseInt(request.getParameter("id"));

        String stringoption = request.getParameter("option");
        System.out.println("stroption:"+stringoption);
        if (stringoption!=null){
            String[] optionstring = new String[2];
            optionstring[0] = "-R";
            optionstring[1] = stringoption;

            lis.SavePreprocessingToExternalFile(dataSetPath + LogicImageSegmentation.FILE_DATA_SET_NAME_ARFF, dataSetPath + LogicImageSegmentation.FILE_DATA_SET_NAME_CSV, filter_id, optionstring);
            System.out.println("change preprocessing , id="+filter_id+",stringoption="+stringoption);
        }else{

            lis.SavePreprocessingToExternalFile(dataSetPath + LogicImageSegmentation.FILE_DATA_SET_NAME_ARFF, dataSetPath + LogicImageSegmentation.FILE_DATA_SET_NAME_CSV, filter_id, null);
            System.out.println("change preprocessing , id="+filter_id);
        }


        //double filter_id = Double.parseDouble(request.getParameter("id"));

        out.print("Preprocessing has been done succesfully -> preprocessing id = " + filter_id);
       }catch(Exception e){
           e.printStackTrace();
           System.out.println("change filter failed");
           out.println("false");
       }
    
    

%>